//  封装和医院列表相关的一系列接口

import { request } from "@/utils/http";
import type { HospitalShowType, ReqHospitalListParams, ReqHospitalListResponse, ReqHospitalUpdateStatusParams, ReqScheduleRuleParams, ScheduleResponse, departmentList, provinceOrCityOrDistrictOrHostypeList, ReqDoctorParams, DoctorList } from "./model/hospitalListTypes";


/**
 * 请求获取医院列表数据的方法
 * @param param0 {page,limit,...args}:ReqHospitalListParams
 * @returns Promise<ReqHospitalListResponse>
 */
export function ReqHospitalList({page,limit,...args}:ReqHospitalListParams){
    return request.get<any,ReqHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`,{
        params:args
    })
}

/**
 * 请求获取省份信息的方法
 * @returns   Promise<provinceList>
 */
export function ReqProvinceListResponse(){
    return request.get<any,provinceOrCityOrDistrictOrHostypeList>("/admin/cmn/dict/findByDictCode/province")
}


/**
 * 请求获取 市 、区、医院类型的方法
 * @param parentId number
 * @returns Promise<provinceOrCityOrDistrictOrHostypeList>
 */
export function ReqCityOrDistrictOrHostypeResponse(parentId:number){
    return request.get<any,provinceOrCityOrDistrictOrHostypeList>(`/admin/cmn/dict/findByParentId/${parentId}`);
}

/**
 * 请求更新医院状态的方法
 * @param param0 {id,status}:ReqHospitalUpdateStatusParams
 * @returns Promise<null>
 */
export function ReqHospitalStatus({id,status}:ReqHospitalUpdateStatusParams){
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`);
}

/**
 * 请求医院详情的方法
 * @param id string
 * @returns Promise<HospitalShowType>
 */
export function ReqHospitalShow(id:string){
    return request.get<any,HospitalShowType>(`/admin/hosp/hospital/show/${id}`);
}

/**
 * 请求医院科室的方法
 * @param hoscode string
 * @returns    Promise<departmentList>
 */
export function ReqDepartmentListResponse(hoscode:string){
    return request.get<any,departmentList>(`/admin/hosp/department/${hoscode}`);
}



/**
 * 请求医院科室 的 排班规则的方法
 * @param param0  {page,limit,hoscode,depcode}:ReqScheduleRuleParams
 * @returns Promise<ScheduleResponse>
 */
export function ReqHospitalScheduleListResponse({page,limit,hoscode,depcode}:ReqScheduleRuleParams){
    return request.get<any,ScheduleResponse>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

/**
 * 请求医生数据的方法
 * @param param0  {hoscode,depcode,workDate}:ReqDoctorParams
 * @returns Promise<DoctorList>
 */
export function ReqDoctorResponse({hoscode,depcode,workDate}:ReqDoctorParams){
    return request.get<any,DoctorList>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}